package com.aiyige.page.my.wallet.model;

import android.text.TextUtils;

/**
 * 单笔明细
 */
public class WalletSingleEntity {

    public final static int TYPE_KEY_VALUE = 1;// 正常的

    public final static int TYPE_DETAIL = 2; // value底部有灰色的一行字

    public final static int TYPE_ORDER_ID = 3; //订单ID要加下划线，点击要跳转到订单详情

    public final static int TYPE_INCOME = 4;//实收金额 前面要加一个小1号的￥

    public final static int TYPE_GREY_VALUE = 5;//value灰色

    private String title;

    private String value;

    private int type = TYPE_KEY_VALUE;

    private String detail;

    private String role;

    private WalletSingleEntity(Builder builder) {
        title = builder.title;
        value = builder.value;
        type = builder.type;
        detail = builder.detail;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public static final class Builder {
        private String title;
        private String value;
        private int type;
        private String detail;

        private Builder() {
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder value(String val) {
            value = val;
            return this;
        }

        public Builder type(int val) {
            type = val;
            return this;
        }

        public Builder detail(String val) {
            detail = val;
            return this;
        }

        public WalletSingleEntity build() {
            return new WalletSingleEntity(this);
        }
    }

    public boolean isBuyer() {
        return !TextUtils.isEmpty(role) && role.equals("buyer");
    }
}
